package addon.w3.mdx.com;

import java.io.IOException;

import addon.w3.mdx.LEDataInputStream;
import addon.w3.mdx.MDXException;
import addon.w3.mdx.MDXParentCOM;

/**
 * TEXS						// [Textures]
	long	nbytes;
	struct {
		long	ReplaceableID;
		ASCII	TexturePath;		(0x100 bytes)
		long	???;			(0)
		long	Wrapping;		(1:WrapWidth;2:WrapHeight;3:Both)
	} textures[ntexs];

 * @author madjk
 *
 */
public class MDXTextures extends MDXParentCOM {
	int length = -1;
	public MDXTextureCOM coms[] = null;
	
	public String getTag() {
		return "TEXS";
	}
	
	public void _decode(LEDataInputStream ins) throws IOException, MDXException {
		length = ins.readInt();
		coms = new MDXTextureCOM[length/268];
		for(int i=0;i<coms.length;i++) {
			coms[i] = new MDXTextureCOM();
			coms[i].decode(ins);
//			System.out.println(coms[i]);
		}
	}
	
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("TAG : "+getTag());
		sb.append("\n\tELEN : "+length);
		if(coms != null && coms.length > 0) sb.append("\n\tTEXS[] : "+coms.length);
		return sb.toString();
	}

	@Override
	public boolean isImplicitTag() {
		// TODO Auto-generated method stub
		return true;
	}
}